function input = makeinput( name, numtypes, numg, numm, order, dat, abdat, elements, bc, ...
                   xcm, xfm, ycm, yfm, mt, tol, maxit, swpi, swnt, swgm, kinit )             
% this function takes user input and creates a data structure
% of all the problem information needed for each solver 

% NUMBER OF ELEMENTS
numel = sum(sum(elements>0));

% GET THE CONNECTIVITY MATRIX
M = connect2D(elements,numel,numg,order,bc);

% UNIFORM GUESS OF LEGENDRE COEFFICIENTS, NORMALIZED
j = zeros(numel*4*(order+1)*numg, 1); 
for gg = 1:numg
    j(gg:(order+1)*numg:end, 1)=1;
end
if nargin < 20
    kinit = 1.0;
end
j = j / norm(j);
x0 = [j; kinit; 1.0]; % Initial guess of unknowns vector

input   =   struct(   'name',          name, ...      % problem name
                      'numtypes',      numtypes, ...  % # different elem's
                      'numg',          numg, ...      % # groups
                      'numm',          numm, ...      % # materials                     
                      'order',         order, ...     % # legendre order
                      'elements',      elements, ...  % element map
                      'numel',         numel, ...     % number elements
                      'dat',           dat, ...       % data
                      'abdat',         abdat, ...     % absorption data
                      'xcm',           xcm, ...       % x course meshes
                      'xfm',           xfm, ...       % x fine meshes
                      'ycm',           ycm, ...       % y course meshes
                      'yfm',           yfm, ...       % y fine meshes  
                      'mt',            mt, ...        % elem's mat spec
                      'M',             M, ...         % connectivity
                      'tol',           tol, ...       % tolerances
                      'maxit',         maxit, ...     % max outer its
                      'x0',            x0, ...        % initial j,k guess
                      'swpi',          swpi, ...      % solve with PI?
                      'swnt',          swnt, ...      % solve with N?
                      'swgm',          swgm ...       % solve with N-G?
              );